<template>
    <view class="user_container">
        
    </view>
</template>

<script>

export default {
  data() {
    return {
      setting: null,
      loginData:'',
      
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    that.log(1,2,1,2,1,2)
    that.outer()
    getApp().globalData.wxLogin(getApp().globalData.more_scene,function(){
        console.log("===prepare_page===",)
        that.enterPage(options);
    });
    console.log("11",that.add())
    console.log("22",that.add())
    console.log("33",that.add())
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
      
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
      
  },
  methods: {
      outer:function () {
            var result = []
            for (var i = 0;i<10;i++){
              result[i] = (function (num) {
                  console.info("====outer====",num)
              })(i)
           }
           return result
      },
    add:function(){
        var counter = 0;
            return function () {return counter += 1;}
        
    }(),
    log:function (){
      console.log("====log====",console,arguments)
      console.log.apply(console, arguments);
    },
    
    enterPage:function(){
        let that = this;
        wx.getNetworkType({
          success: function (res) {
            if (res.networkType == 'none') {
              //无网络
              console.error('无网络');
              that.setNav();
              that.setData({
                showLoadFail: true
              });
            }
          }
        });
        let url='/pages/index/index'
        that.tolinkUrlFun(url)
    },
    tolinkUrlFun:function(url){
        if(url){
            uni.reLaunch({
              url: url
            });
        }
    },
    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  }
};
</script>
<style>
@import "./index.css";
</style>